<template>
  <div>
    <el-card>
      <div slot="header">
        <el-page-header content="广告添加" @back='back'></el-page-header>
      </div>
      <div>
        <el-form ref="form" :model="formData" label-width="80px">
          <el-form-item label="房产名称">
            <el-input v-model="formData.propertyname" placeholder=""></el-input>
          </el-form-item>
            <el-form-item label="房产编号">
            <el-input v-model="formData.id" placeholder=""></el-input>
          </el-form-item>
          <el-form-item label="广告甲方">
            <el-input v-model="formData.issuer"></el-input>
          </el-form-item>
          <el-form-item label="开始时间">
            <div class="out">
              <el-date-picker
                v-model="formData.startDate"
                type="date"
                placeholder="选择开始日期"
                value-format="yyyy/MM/dd HH:mm"
              >
              </el-date-picker>
            </div>
          </el-form-item>
          <el-form-item label="结束时间">
            <div class="out">
              <el-date-picker
                  v-model="formData.endDate"
                  type="date"
                  placeholder="选择结束日期"
                  value-format="yyyy/MM/dd HH:mm"
              >
              </el-date-picker>
            </div>
          </el-form-item>
          <el-form-item label="推送海报">
              <el-upload
            :multiple="false"
            ref="uploadidCardImg_back"
            action=" "
       
            :auto-upload="false"
            :http-request="upload"
          >
            <el-button size="small" type="text">点击上传</el-button>
          </el-upload>
          </el-form-item>
          <el-form-item >
            <el-button type="primary" @click="add">添加</el-button>
          </el-form-item>
        
        </el-form>
      </div>
    </el-card>
  </div>
</template>

<script>
export default {
  
  methods: {
    add(){
      console.log(this.formData)
      this.$store.commit('insert_db_adv',this.formData)
      this.$router.push('advertisement-show')
    },
    back(){
        this.$router.go(-1)
      },
    upload() {},
  },
  data() {
    return {
      formData: {
        propertyname: "",
        id:"",
        issuer: "",
        startDate: "",
        endDate: "",
        file: null,
      },
    };
  },
};
</script>

<style scoped>
.el-card {
  margin-top: 2rem;
}
.el-form {
  width: 70%;
  margin: auto;
}
.el-form .el-select,
.el-date-picker {
  width: 100%;
}
.out >>> .el-date-editor {

  width: 100%;
}
</style>